clear
clc
close all
format short

%Carburizing
depth = .1:.01:3;               %mm
HeatingTime = ((depth/.2)+3);   %hours

figure;
plot(depth,HeatingTime);
title('Heating Time vs. Desired Depth')
xlabel('Depth (mm)')
ylabel('Heating Time (hours)')
grid on

%Shot Peening
M = .2;                         %g
V = 25;                         %m/s
HVW = 107;          
p = 2.7;                        %g/mm^3

a1 = .074;
a2 = 726.728;
a3 = .049;
a4 = .011;

C = a1*((M*V^2)^(1/2))*(HVW^(-1/3))+a2*((M/HVW)^1/2)+a3*(((3*M)/((4*pi)/p))^(1/2))+a4 %mm

a1 = .02;
a2 = 2602.19;
a3 = .726;
a4 = .104;

R = a1*((M*V^2)^(1/2))*(HVW^(-1/3))+a2*((M/HVW)^1/2)+a3*(((3*M)/((4*pi)/p))^(1/2))+a4 %mm

%Tempering
T = 500:1:1000;                 %K
t = 1800:32.4:18000;            %s
Percent = .01;             

C = 21.3 - (5.8*Percent);

Hp = (T/1000).*(C+log(t));

figure;
plot(T,Hp);
title('Holomon-Jaffe Constant vs. Heating Temperature')
xlabel('Temperature (K)')
ylabel('Holomon-Jaffe Constant')
grid on

figure;
plot(t,Hp);
title('Holomon-Jaffe Constant vs. Heating Time')
xlabel('Time (s)')
ylabel('Holomon-Jaffe Constant')
grid on
